# __*__ coding: utf-8 __*__
from pathlib import Path
from typing import Dict


class SingletonMeta(type):
    _instance: Dict = {}

    def __call__(cls, *args, **kwargs):
        if cls not in cls._instance:
            cls._instance[cls] = super(SingletonMeta, cls).__call__(*args, **kwargs)
        return cls._instance[cls]


class Ctx(metaclass=SingletonMeta):

    def __init__(self):
        self._pending_msg = ""
        self.__work_dir = Path()

    def set_pending_mas(self, value: str):
        self._pending_msg = value

    def set_work_dir(self, value: str):
        self.__work_dir = value


class Test:
    def __init__(self, ctx: Ctx):
        self._ctx = ctx

    def set(self):
        self._ctx.set_work_dir(value="/data/test")


test = Test(Ctx())
test.set()










